#ifndef DATA_SET_H
#define DATA_SET_H

#include <QTime>
#include <QList>
#include <QHash>
#include <QObject>
#include <QString>
#include <QTreeWidgetItem>

#include "individual.h"
#include "locus_frequency.h"
#include "allele_frequencies.h"

class DataSet
{
public:
    DataSet();
    DataSet( QList<Individual*> inds );

    inline int numInds() { return _individuals.count(); }
    void addIndividual( Individual *ind );
    void addIndividuals( QList<Individual*> inds );
    Individual* getIndividual( int idx );
    QStringList getStrataKeys();

    inline int numPops() { return _populations.keys().count(); }
    inline QStringList getStrataNames() { return _populations.keys(); }
    int popSize( QString key );

    void partitionByStratum( QString key );
    void resetPartitions();


    AlleleFrequencies* getTotalFrequencies();
    AlleleFrequencies* getStratumFrequencies( QString key );

    inline QString getLog() { return _activityLog; }
    void addToLog( QString msg );

    inline void setPath( QString path )     { _path = path; }
    inline QString getPath()                { return _path; }

    QTreeWidgetItem* getTreeWidgetItem()    { return _treeWidgetItem; }

    void removedMonomorphicLoci();

private:
    QTreeWidgetItem *_treeWidgetItem;
    QString _activityLog;
    QString _path;

    AlleleFrequencies* _totalFreqs;
    QList<Individual*> _individuals;

    QHash<QString, QList<Individual*> > _populations;
    QHash<QString, AlleleFrequencies*> _popFreqs;

};

#endif // DATA_SET_H
